home *** CD-ROM | disk | FTP | other *** search
- Customizing ALPHA
-
- Alpha can be customized through key bindings, variable
-
- definitions, and macros. All three customizations are
-
- written in language that Alpha can recognize, and stored
-
- in ordinary text files. The customizations can be loaded
-
- in three ways:
-
-
- 1) The 'AlphaBits' file is always loaded at startup.
-
- 2) The "Load Window" item of the Customize menu loads
-
- an entire window at once.
-
- 3) If a selection is hilited, the above item
-
- changes to "Load Selection", and only
-
- the hilited text get loaded.
-
-
- The language that Alpha recognizes has several different
-
- types of statements:
-
-
- Key Bindings
-
-
- Any function or loaded macro can be bound to any single
-
- keystroke. One way to bind a function is with a
-
- statement such as:
-
-
- (bind '<character>' [modifier string] funcName)
-
-
- where c is a character, 'modifier string' is a string
-
- containing one or more of:
-
-
- c - command modifier
-
- o - option modifier
-
- s - shift modifier
-
- z - control modifier
-
- e - escape modifier
-
- x - prefixChar modifier
-
-
- The following line binds cmd-shift-f to the function
-
- 'forwardChar':
-
-
- (bind 'f' <cs> forwardChar)
-
-
- With the standard US keyboard, 'forwardChar' could also
-
- be bound by using the keycode for the 'f' key:
-
-
- (bind '\03' <cs> forwardChar)
-
-
- The key code for any given key can be obtained by using
-
- the 'keyCode' function. While the first form is
-
- machine-independent, the second form is
-
- machine-dependent. In both forms, the modifier string is
-
- optional. To use ALPHA with an original mac keyboard,
-
- comment out the line:
-
-
- "#define MACII ....."
-
-
- Note that menu item command equivalents take precedence
-
- over bindings. Command equivalents can only be changed
-
- by using an external tool like 'ResEdit'.
-
-
- Unbindings
-
-
- The following forms allow bindings to be removed:
-
- (ubind '<single character>' [modifier str])
-
- (ubind '\<2-digit hex key code>' [modifier str])
-
- (ubind <ascii code> [modifier str])
-
-
-
- Assigning Values to Variables
-
-
- There are many user-definable integer variables in
-
- ALPHA. Variables can be assigned as follows:
-
-
- (set sillyVar 1)
-
-
- The values 'on' and 'off' map to '1' and '0',
-
- respectively, so the above example could be written:
-
-
- (set sillyVar on)
-
-
- There are also a few string variables, which are bound
-
- in an analogous fashion:
-
-
- (set dumString "the string")
-
-
-
-
-
-
-
-
-
-
-
-
- The 'Open Special' Menu
-
-
- Files can be attached to a hierarchical menu hanging
-
- from 'File:Open Special'. These files are specified by
-
- complete pathname with the following syntax:
-
-
- (special
-
- "<pathname>"
-
- : : )
-
-
- Command equivalents can be attached to items by
-
- appending '/<char>' to the end ONLY of the complete
-
- file-pathname,
-
-
-
- User-defined Menus
-
-
- Alpha allows the the user to build custom menus which
-
- contain names of functions or macros that just HAVE to
-
- be in the menus, as opposed to being merely callable
-
- through the bindings. The syntax is dead simple. See the
-
- 'AlphaBits' file for an example. The following meta
-
- characters can be embedded in the strings:
-
-
- Meta-character Usage
-
- -------------- -----
-
-
- ; or Return Separates multiple items.
-
- ^ Followed by an icon number, adds
-
- that icon to the item.
-
- ! Followed by a character, marks the
-
- item with that character.
-
- < Followed by B, I, U, O, or S, sets
-
- the character style of the item.
-
- / Followed by a character, sets up
-
- a keyboard equivalent.
-
- ( Disables the item.
-
-
- Once the menus are created, they can be inserted and
-
- deleted from the menu bar by the syntax:
-
- (insertMenu "name")
-
- (deleteMenu "name")
-
- as well as through macros.
-
-
- The following strings have the obvious special meanings
-
- when used as menu item text:
-
- TILEMENU
-
- FLAGMENU
-
- VARMENU
-
- ACMDMENU
-
- MACROMENU
-
- FSETMENU
-
- WINDOWMENU
-
-
- The 'WINDOWMENU' (the menu that allows selection of
-
- windows) cannot be redefined after startup and can only
-
- be used in one menu.
-
-
-
-
- Suffix Hooks
-
-
- Alpha allows you to specify that a macro be executed
-
- whenever a file with the correct suffix is opened or
-
- activated. The syntax is:
-
-
- (suffixHook ".<suffix>" <macroName>)
-
-
- For example:
-
-
- (suffixHook ".c" setCMode)
-
-
- executes the macro 'setCMode' whenever a window ending
-
- in .c is loaded or activated. Suffixes can not be more
-
- than five characters in length. The only way to remove
-
- suffix hooks is to restart.
-
-
-
-
-
-
-
-
-
-
- Miscellaneous Syntax Matter
-
-
- Comments begin with ';' and continue to the end of the
-
- current line.
-
-
- The #define, #ifdef, #else, and #endif preprocessor
-
- commands can be used in a loaded file as follows:
-
-
- #ifdef TAG
-
- <first set of definitions>
-
- #else TAG
-
- <second set of definitions>
-
- #endif TAG
-
-
- If 'TAG' is defined as follows:
-
-
- #define TAG
-
-
- the first set of definitions will be loaded. Otherwise
-
- the second set will be loaded. The else clause is
-
- optional. Ifdefs can not be nested.
-
-
-
-
-
-